<%@page import="java.util.Map"%>
<%@page import="org.proddevplm.constants.ControllerConstants"%>
<%@page import="org.proddevplm.dao.data.Product"%>
<%@page import="java.util.List"%>
<%@page import="java.util.Calendar"%>
<%@page import="org.proddevplm.dao.data.User"%>
<%@page import="org.proddevplm.dao.data.RelationMatrix"%>
<%@page import="org.proddevplm.constants.UserConstants"%>
<%@page import="java.util.GregorianCalendar"%>

<head> 
	<link type="text/css" href="style/proddevplm.css" rel="stylesheet" />
</head>

<div style="width:100%; font-family:verdana;">	
	<div style="float:left; color:darkblue; font-style:italic; font-size:large; width:30%">
	
		<a href="/proddev/controller?manager=flowManager&method=3"><b>@PLM<i style="font-size:xx-small">beta</i></b></a>
	
	</div>
	
	<div style="width:40%; font-size:x-small; text-align:center; float:left; margin-top:3px">
		<%
		
		GregorianCalendar gcalendar = new GregorianCalendar();
		String months[] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};%>
		Date: <%=gcalendar.get(Calendar.DATE)%> <%=months[gcalendar.get(Calendar.MONTH)]%> <%=gcalendar.get(Calendar.YEAR)%><br />
		
		<%
		List<RelationMatrix> relMatrix = (List)session.getAttribute("relationMatrix");
		Product currentProduct = (Product)session.getAttribute("currentProduct");
		
		Map stateMap = (Map)session.getAttribute(ControllerConstants.STATE_MAP);
		String nextPage = (String)stateMap.get(ControllerConstants.NEXT_PAGE);
		if(nextPage != "content/project/projectPage.jsp"){
			relMatrix = null;
			currentProduct = null;
		}
		
		if (relMatrix != null){
			if(currentProduct != null){
				RelationMatrix r = relMatrix.get(0);
				%>
				<b>Project: </b><%=r.getProject().getName() %>&nbsp;&nbsp;&nbsp;<b>Product: </b><%=currentProduct.getName()%>
				<%} 
			else {
				RelationMatrix r = relMatrix.get(0);
				%>
				<b>Project: </b><%=r.getProject().getName() %>
			<%}
		}%>
		
	</div>
	
		<%
		User loggedUser = (User) session.getAttribute(UserConstants.USER);
		if (loggedUser != null) {
			%>
			<div style="width:30%; font-size: xx-small; float: right; text-align:right">
			You are logged in as: <b><i><%=loggedUser.getSurname()%> <%=loggedUser.getName()%></i></b>
			<a style="font-family: verdana; font-size: x-small;"
				href="/proddev/controller?manager=userManager&method=6"><img
				src="/proddev/images/iconLogout3.png" align="middle" alt="logout?" width="25" height="25" style="border:0px"/></a></div>
			<%
				}
			%>
	
	<div style="clear:both;"></div>
</div>
<hr />